package com.example.demo;

import com.example.demo.model.MyList;
import com.example.demo.model.Student;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication implements InitializingBean {

	@Value("${mykey}")
	private String mykey;

	@Value("${null.value}")
	private String nullValue;

	@Value("${cctalk.token}")
	private String cctalkToken;

	@Autowired
	private Student student;

	@Autowired
	private MyList myList;

	public static void main(String[] args) {
		SpringApplication.run(DemoApplication.class, args);
	}


	//通过InitializingBean接口，重写afterPropertiesSet()方法，参数设置完成之后，执行此方法
	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println();
		System.out.println("afterPropertiesSet");
		System.out.println(cctalkToken);
		System.out.println(mykey);
		System.out.println(nullValue);
		System.out.println(student);
		System.out.println(myList);
		System.out.println();
	}
}
